import React, { useEffect, useState } from 'react';
import { Header } from './components/Header';
import { Footer } from './components/Footer';
import { HomePage } from './components/HomePage';
import { CookieBanner } from './components/CookieBanner';
import { Outlet, useLocation } from 'react-router-dom';
export function App() {
  const [showCookieBanner, setShowCookieBanner] = useState(false);
  const location = useLocation();
  useEffect(() => {
    // Check if user has already accepted cookies
    const cookiesAccepted = localStorage.getItem('cookiesAccepted');
    if (!cookiesAccepted) {
      setShowCookieBanner(true);
    }
    // Scroll to top on route change
    window.scrollTo(0, 0);
  }, [location.pathname]);
  const acceptCookies = () => {
    localStorage.setItem('cookiesAccepted', 'true');
    setShowCookieBanner(false);
  };
  return <div className="min-h-screen bg-[#f8f5f0] text-[#4a4a4a] font-sans">
      <Header />
      <main>{location.pathname === '/' ? <HomePage /> : <Outlet />}</main>
      <Footer />
      {showCookieBanner && <CookieBanner onAccept={acceptCookies} />}
    </div>;
}